<template>
	<view>
		<titlebar mode="车辆预定" :back="true" text="车辆预定" :backgroundColor='backgroundColor' :color='color'>
			<view slot="title">

				<view class="titleText" :style='"color:" + color'>车辆预定</view>
			</view>
		</titlebar>

		<image class="top-img" mode="aspectFit" :src="carImage||'@appstatic/car/car_banner.jpg'" />

		<view class="header" id="header">
			<view class="tab-bar" :class="tabIndex==1?'color-1':'color-2'">
				<view @click="changeTab(1)"
					:class="tabIndex==1?'tab-bar-item-clickable tab-bar-item-active':'tab-bar-item-clickable'">车系
				</view>


				<view @click="changeTab(2)" v-if="carSeriesNextClicked==true"
					:class="tabIndex==2?'tab-bar-item-clickable tab-bar-item-active':'tab-bar-item-clickable'">车型
				</view>
				<view v-else @click="carReservationTips"
					:class="tabIndex==2?'tab-bar-item tab-bar-item-active':'tab-bar-item'">车型
				</view>

				<view @click="changeTab(3)" v-if="configNextClicked==true"
					:class="tabIndex==3?'tab-bar-item-clickable tab-bar-item-active':'tab-bar-item-clickable'">配置
				</view>
				<view v-else @click="carReservationTips"
					:class="tabIndex==3?'tab-bar-item tab-bar-item-active':'tab-bar-item'">配置
				</view>

				<view @click="changeTab(4)" v-if="colorNextClicked==true"
					:class="tabIndex==4?'tab-bar-item-clickable tab-bar-item-active':'tab-bar-item-clickable'">颜色
				</view>
				<view v-else @click="carReservationTips"
					:class="tabIndex==4?'tab-bar-item tab-bar-item-active':'tab-bar-item'">颜色
				</view>
				<view @click="changeTab(5)" v-if="optionalNextClicked==true"
					:class="tabIndex==5?'tab-bar-item-clickable tab-bar-item-active':'tab-bar-item-clickable'">选装包
				</view>
				<view v-else @click="carReservationTips"
					:class="tabIndex==5?'tab-bar-item tab-bar-item-active':'tab-bar-item'">选装包
				</view>

				<view @click="changeTab(6)" v-if="individuationNextClicked==true"
					:class="tabIndex==6?'tab-bar-item-clickable tab-bar-item-active':'tab-bar-item-clickable'">个性化
				</view>

				<view v-else @click="carReservationTips"
					:class="tabIndex==6?'tab-bar-item tab-bar-item-active':'tab-bar-item'">个性化
				</view>

			</view>
		</view>

		<view class="listView">
			<scroll-view :refresher-enabled='false' scroll-y style=" height: 100%;width: 100%">
				<carSeries v-show="tabIndex==1" :carSeriesList="carSeriesList" @carSeriesItem="getCarSeries"
					@carSeriesItem_watch="getCarSeriesForWatch">
				</carSeries>
				<carType v-show="tabIndex==2" :carTypeList="carTypeList" @carTypeItem="getCarType"
					@carTypeItem_watch="getCarTypeForWatch" ref="carTypeItemStyle">
				</carType>
				<configure v-show="tabIndex==3" :configureList="configureList" @configureItem="getConfigure"
					@configureItem_watch="getConfigureForWatch" @configureWatchMore="configureWatchMore"> </configure>
				<color v-show="tabIndex==4" :colorList="colorList" @colorItem="getColor"
					@colorItem_watch="getColorForWatch"> </color>
				<optional v-show="tabIndex==5" :optionalList="optionalList" @optionalItem="getOptional"
					@optionalItem_watch="getOptionalForWatch" @optionalWatchMore="optionalWatchMore">
				</optional>
				<individuation v-show="tabIndex==6" :individuationList="individuationList"
					@individuationItem="getIndividuation" @individuationItem_watch="getIndividuationForWatch">
				</individuation>
			</scroll-view>
		</view>

		<view class="info-transverse-">

			<view class="test1">￥<text class="before">{{totlePrice}}</text></view>
			<view class="text-next" @click="next">下一步</view>
		</view>


		<u-popup :show="showCloak" bgColor="transparent" mode="center" :mask-click="false">
			<div class="cloak_popup">
				<view class="pop-view">
					<view class="pop_text1">{{popTitle}}</view>
					<scroll-view scroll-y="true" style="margin-top: 16px;height:calc(100% - 64px);">
						<view v-show="popTitle=='配置详情'" class="pop_text2">{{carConfigDescribe}}</view>
						<view v-show="popTitle=='选装包详情'" v-for="(item2,index2) in packageDescribeList">

							<view class="pop-view1" v-show="item2!=''&&item2!=null">
								<view class='point'> </view>
								<view class="pop_text3">{{item2}}</view>
							</view>
						</view>

					</scroll-view>
				</view>

				<image @click="closePopup()" class="close_popup"
					src="@appstatic/car/car_popup_close.png" mode=""></image>
			</div>
		</u-popup>

	</view>
</template>

<script>
	const app = getApp();
	const network = require("@manager/network-manager.js");
	const util = require('@utils/util.js');
	import carSeries from '@/components/carReservation/carSeries.vue';
	import carType from '@/components/carReservation/carType.vue';
	import configure from '@/components/carReservation/configure.vue';
	import color from '@/components/carReservation/color.vue';
	import optional from '@/components/carReservation/optional.vue';
	import individuation from '@/components/carReservation/individuation.vue';
	export default {
		components: {
			carSeries,
			carType,
			configure,
			color,
			optional,
			individuation
		},
		data() {
			return {
				showCloak: false,
				popTitle: '',
				carConfigDescribe: '',
				packageDescribeList: [],

				isFirstEnter: true,
				color: '#000000',
				backgroundColor: 'rgba(0, 0, 0, 0)',
				carImage: "",
				tabIndex: 1,
				//车系
				carSeriesList: [], //车系列表
				carSeriesChoice: false, //车系是否被选
				choice_seriesId: '', //被选的车系id
				carSeriesNextClicked: false, //车系页面下一次是否被点击
				// carSeriesPrice: 0,
				carSeriesEntity: null, //选中的车系实体
				//车型
				carTypeList: [], //车型列表
				carTypeChoice: false, //车型是否被选中
				choice_modelId: '', //被选的车型id
				carTypeNextClicked: false,
				// carTypePrice: 0,
				carTypeEntity: null, //选中的车型实体
				//配置
				configureList: [],
				configChoice: false,
				choice_configId: '',
				configNextClicked: false,
				configurePrice: 0,
				configureEntity: null, //选中的配置实体
				//颜色
				colorList: [],
				colorChoice: false,
				choice_colorId: '',
				colorNextClicked: false,
				colorPrice: 0,
				colorEntity: null, //选中的颜色实体
				//选装包
				optionalList: [],
				optionalChoice: false,
				choice_optionaId: '',
				optionalNextClicked: false,
				optionalPrice: 0,
				optionalEntity: null, //选中的选装包实体
				//个性化
				individuationList: [],
				individuationChoice: false,
				choice_individuationId: '',
				choice_individuationText: '',
				individuationNextClicked: false,
				individuationPrice: 0,
				individuationEntity: null, //选中的个性化实体

				totlePrice: 0, //总价
				from: "", //from 心愿单编辑、心愿单转订单、立即预定
				wishId: '',
				//心愿单编辑专用标识，如果车系、车型、配置、颜色、选装包、个性化 六个teb下的任意一个item被点击，则认为心愿单被编辑，则调用心愿单更新接口，否则视为查看心愿单详情，不调用更新方法
				tebsItemClicked: false

			}
		},
		onLoad(options) {
			if (options.from == "立即预定") {
				this.choice_seriesId = options.seriesId;
				this.from = "车辆配置"
				this.getLevcCarSeriesList()
				this.getLevcCarModelList(this.choice_seriesId)


			} else {
				this.wishId = options.wishId
				this.from = options.from
				// this.wishId = '1542682962389241856'
				this.choice_seriesId = ""
				this.getWishDetail(this.wishId)

			}




		},
		methods: {
			configureWatchMore: function(carConfigDescribe) {
				this.showCloak = true
				this.popTitle = "配置详情"
				this.carConfigDescribe = carConfigDescribe
			},
			optionalWatchMore: function(packageDescribeList) {
				this.showCloak = true
				this.popTitle = "选装包详情"
				this.packageDescribeList = packageDescribeList
			},
			closePopup() {
				this.showCloak = false
				this.popTitle = ""
			},
			//心愿单详细
			getWishDetail: function(wishId) {
				var that = this;
				var uri = app.globalData.config.interfaces.URL_CAR_WISH_GET;
				var params = {
					"id": wishId,
					"loginId": app.getUserId()
				}


				console.log(params, 'params')
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						that.choice_seriesId = res.data.seriesId + "";
						that.choice_modelId = res.data.modelId + "";
						that.choice_configId = res.data.modelConfigureId + "";
						that.choice_colorId = res.data.colorId + "";


						that.totlePrice = parseFloat(res.data.orderAmount)
						that.configurePrice = parseFloat(res.data.modelConfigureMoney)
						that.colorPrice = parseFloat(res.data.colorMoney)


						if (res.data.servicepkgInfos.length != 0) {
							that.choice_optionaId = res.data.servicepkgInfos[0].serverId + "";
							that.optionalPrice = parseFloat(res.data.servicepkgInfos[0].serverMoney)
						}
						if (res.data.uniqueserverInfos.length != 0) {
							that.choice_individuationId = res.data.uniqueserverInfos[0].serverId + "";

							that.choice_individuationText = res.data.uniqueserverInfos[0].uniqueContent + "";
							that.individuationPrice = parseFloat(res.data.uniqueserverInfos[0].serverMoney)

						}
						that.carSeriesNextClicked = true
						that.carTypeNextClicked = true
						that.configNextClicked = true
						that.colorNextClicked = true
						that.optionalNextClicked = true
						that.individuationNextClicked = true
						that.carSeriesChoice = true
						that.carTypeChoice = true
						that.configChoice = true
						that.colorChoice = true
						that.optionalChoice = true
						that.individuationChoice = true

						that.getLevcCarSeriesList()
						that.getLevcCarModelList(that.choice_seriesId)
						that.getLevcConfigList(that.choice_modelId)
						that.getCarConfigureInfos(that.choice_configId)




					} else {
						setTimeout(() => {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}, 500)
					}
				}).catch(res => {

				});
			},


			//获取车系信息
			getCarSeries: function(carSeries) {
				this.tebsItemClicked = true
				this.carSeriesNextClicked = false
				this.carTypeNextClicked = false
				this.configNextClicked = false
				this.colorNextClicked = false
				this.optionalNextClicked = false
				this.individuationNextClicked = false

				this.carSeriesEntity = carSeries
				this.carSeriesChoice = true

				this.choice_seriesId = carSeries.uuid
				this.carImage = carSeries.seriesImage

				//获取该车系的最低价作为总数
				this.getMinMoneyByCarConfigure("车系")

				//车型
				this.carTypeEntity = null
				this.carTypeList = []
				this.getLevcCarModelList(this.choice_seriesId)
				this.carTypeChoice = false
				this.choice_modelId = ""
				//配置
				this.configureEntity = null
				this.configureList = []
				this.configurePrice = 0
				this.configChoice = false
				this.choice_configId = ""
				//颜色
				this.colorEntity = null
				this.colorList = []
				this.colorPrice = 0
				this.colorChoice = false
				this.choice_colorId = ""
				//选装包
				this.optionalEntity = null
				this.optionalList = []
				this.optionalPrice = 0
				this.optionalChoice = false

				this.choice_optionaId = ""
				//个性化
				this.individuationEntity = null
				this.individuationList = []
				this.individuationPrice = 0
				this.choice_individuationId = ""
				this.individuationChoice = false
			},

			getCarSeriesForWatch: function(carSeries) {
				this.carSeriesChoice = true
				this.choice_seriesId = carSeries.uuid
				this.carImage = carSeries.seriesImage
			},

			//获取车型信息
			getCarType: function(carType) {
				this.tebsItemClicked = true
				this.carTypeNextClicked = false
				this.configNextClicked = false
				this.colorNextClicked = false
				this.optionalNextClicked = false
				this.individuationNextClicked = false

				this.carTypeEntity = carType
				this.carTypeChoice = true

				this.choice_modelId = carType.uuid
				//获取该车型的最低价作为总数
				this.getMinMoneyByCarConfigure("车型")
				//配置
				this.configureEntity = null
				this.configureList = []
				this.configurePrice = 0
				this.getLevcConfigList(this.choice_modelId)
				this.configChoice = false
				this.choice_configId = ""
				//颜色
				this.colorEntity = null
				this.colorList = []
				this.colorPrice = 0
				this.choice_colorId = ""
				this.colorChoice = false
				//选装包
				this.optionalEntity = null
				this.optionalList = []
				this.optionalPrice = 0
				this.choice_optionaId = ""
				this.optionalChoice = false

				//个性化
				this.individuationEntity = null
				this.individuationList = []
				this.individuationPrice = 0
				this.choice_individuationId = ""
				this.individuationChoice = false

			},
			getCarTypeForWatch: function(carType) {
				this.carTypeChoice = true
				this.choice_modelId = carType.uuid
			},

			//获取配置信息
			getConfigure: function(config) {
				this.carImage = config.carImgUrl
				this.tebsItemClicked = true
				this.configNextClicked = false
				this.colorNextClicked = false
				this.optionalNextClicked = false
				this.individuationNextClicked = false

				this.configureEntity = config
				this.configChoice = true
				this.choice_configId = config.id
				if (config.carConfigMoney != null && config.carConfigMoney != "" && config.carConfigMoney !=
					undefined && config.carConfigMoney != "0") {
					this.configurePrice = config.carConfigMoney
					if (typeof(this.configurePrice) == "string") {
						this.configurePrice = parseFloat(this.configurePrice)
					}
				} else {
					this.configurePrice = 0
				}
				this.configureEntity.carConfigMoney = this.configurePrice
				this.getTotlePrice()
				//颜色
				this.colorEntity = null
				this.colorList = []
				this.colorPrice = 0
				this.choice_colorId = ""
				this.colorChoice = false
				//选装包
				this.optionalEntity = null
				this.optionalList = []
				this.optionalPrice = 0
				this.choice_optionaId = ""
				// this.optionalChoice = false

				//个性化
				this.individuationEntity = null
				this.individuationList = []
				this.individuationPrice = 0
				this.choice_individuationId = ""
				this.individuationChoice = false
				this.getCarConfigureInfos(this.choice_configId)

			},
			getConfigureForWatch: function(config) {
				this.configChoice = true
				this.choice_configId = config.id
			},

			//获取颜色信息
			getColor: function(color) {
				debugger
				this.tebsItemClicked = true
				if (this.from == "车辆配置") {
					this.colorNextClicked = false
				}

				this.carImage = color.configureImg

				this.colorEntity = color
				this.choice_colorId = color.id

				this.colorChoice = true
				if (color.colorPrice != null && color.colorPrice != "" && color.colorPrice != undefined && color
					.colorPrice != "0") {
					this.colorPrice = color.colorPrice
					if (typeof(this.colorPrice) == "string") {
						this.colorPrice = parseFloat(this.colorPrice)
					}
				} else {
					this.colorPrice = 0
				}
				this.getTotlePrice()
			},
			getColorForWatch: function(color) {
				this.colorChoice = true
				this.choice_colorId = color.id
			},

			//获取选装包信息
			getOptional: function(optional) {
				this.tebsItemClicked = true

				// this.optionalNextClicked = false

				if (optional.clicked == 1 || optional.clicked == true || optional.clicked == "true") {
					this.optionalEntity = optional
				} else {
					this.optionalEntity = null
				}

				this.choice_optionaId = optional.id
				this.optionalChoice = true

				if (optional.clicked == 1) {
					if (optional.packagePrice != null && optional.packagePrice != "" && optional.packagePrice !=
						undefined && optional.packagePrice != "0") {
						this.optionalPrice = optional.packagePrice
						if (typeof(this.optionalPrice) == "string") {
							this.optionalPrice = parseFloat(this.optionalPrice)
						}
					} else {
						this.optionalPrice = 0
					}
				} else {
					this.optionalPrice = 0
				}

				this.getTotlePrice()
			},

			getOptionalForWatch: function(optional) {
				this.optionalChoice = true
				this.choice_optionaId = optional.id
			},
			//获取选装包信息
			getIndividuation: function(individuation) {
				this.tebsItemClicked = true

				// this.individuationNextClicked = false
				if (individuation.clicked == 1 || individuation.clicked == true || individuation.clicked == "true") {
					this.individuationEntity = individuation
				} else {
					this.individuationEntity = null
				}

				this.choice_individuationId = individuation.id
				this.individuationChoice = true


				if (individuation.clicked == 1) {
					if (individuation.serverPrice != null && individuation.serverPrice != "" && individuation
						.serverPrice != undefined && individuation.serverPrice != "0") {
						this.individuationPrice = individuation.serverPrice
						if (typeof(this.individuationPrice) == "string") {
							this.individuationPrice = parseFloat(this.individuationPrice)
						}
					} else {
						this.individuationPrice = 0
					}
				} else {
					this.individuationPrice = 0
				}

				this.getTotlePrice()




			},
			getIndividuationForWatch: function(individuation) {
				this.individuationChoice = true
				this.choice_individuationId = individuation.id
			},

			getTotlePrice: function() {
				this.totlePrice = (this.configurePrice * 1000 + this.colorPrice * 1000 +
					this.optionalPrice * 1000 + this.individuationPrice * 1000) / 1000
			},
			carReservationTips: function() {
				console.log("当前是选择第" + this.tabIndex + "步骤")
				var msg = ""
				if (this.tabIndex == "1") {
					if (this.carSeriesChoice == true) {
						msg = "点击下一步"
					} else {
						msg = "请选择车系"
					}
					setTimeout(() => {
						uni.showToast({
							title: msg,
							duration: 3000,
							icon: 'none'
						})
					}, 500)

				} else if (this.tabIndex == "2") {

					if (this.carTypeChoice == true) {
						msg = "点击下一步"
					} else {
						msg = "请选择车型"
					}
					setTimeout(() => {
						uni.showToast({
							title: msg,
							duration: 3000,
							icon: 'none'
						})
					}, 500)
				} else if (this.tabIndex == "3") {

					if (this.configChoice == true) {
						msg = "点击下一步"
					} else {
						msg = "请选择配置"
					}
					setTimeout(() => {
						uni.showToast({
							title: msg,
							duration: 3000,
							icon: 'none'
						})
					}, 500)
				} else if (this.tabIndex == "4") {

					if (this.colorChoice == true) {
						msg = "点击下一步"
					} else {
						msg = "请选择颜色"
					}
					setTimeout(() => {
						uni.showToast({
							title: msg,
							duration: 3000,
							icon: 'none'
						})
					}, 500)
				}



			},

			//点击下一步
			next: function() {
				var that = this
				console.log("当前是选择第" + this.tabIndex + "步骤")
				if (that.tabIndex < 6) {
					if (that.tabIndex == "1") {
						if (that.carSeriesChoice == true) {
							that.tabIndex = that.tabIndex + 1
							that.carSeriesNextClicked = true
						} else {
							setTimeout(() => {
								uni.showToast({
									title: "请选择车系",
									duration: 3000,
									icon: 'none'
								})
							}, 500)
						}


					} else if (that.tabIndex == "2") {
						if (that.carTypeChoice == true) {
							that.tabIndex = that.tabIndex + 1
							that.carTypeNextClicked = true
						} else {
							setTimeout(() => {
								uni.showToast({
									title: "请选择车型",
									duration: 3000,
									icon: 'none'
								})
							}, 500)
						}

					} else if (that.tabIndex == "3") {
						if (that.configChoice == true) {
							that.tabIndex = that.tabIndex + 1
							that.configNextClicked = true
						} else {
							setTimeout(() => {
								uni.showToast({
									title: "请选择配置",
									duration: 3000,
									icon: 'none'
								})
							}, 500)
						}
					} else if (that.tabIndex == "4") {
						if (that.colorChoice == true) {
							that.tabIndex = that.tabIndex + 1
							that.colorNextClicked = true
						} else {
							setTimeout(() => {
								uni.showToast({
									title: "请选择颜色",
									duration: 3000,
									icon: 'none'
								})
							}, 500)
						}
					} else if (that.tabIndex == "5") {
						that.tabIndex = that.tabIndex + 1
						that.optionalNextClicked = true
						that.individuationNextClicked = true
					}

				} else {
					// for (var i = 0; i < that.individuationList.length; i++) {


					if (this.individuationEntity != null && (this.individuationEntity.clicked == 1 || this
							.individuationEntity.clicked == true ||
							this.individuationEntity.clicked == "true") && (this.individuationEntity
							.uniqueContent == "" || this.individuationEntity
							.uniqueContent == null || this.individuationEntity
							.uniqueContent == undefined)) {

						if (this.individuationEntity.edit != undefined && this.individuationEntity.edit != '') {
							setTimeout(() => {
								uni.showToast({
									title: "请点击确认按钮",
									duration: 3000,
									icon: 'none'
								})
							}, 500)
						} else {
							setTimeout(() => {
								uni.showToast({
									title: "请输入个性化内容",
									duration: 3000,
									icon: 'none'
								})
							}, 500)
						}
						return
					}
					// }
					// that.individuationNextClicked = true
					if (util.isLogin(getApp())) {
						var optionalJson = null
						if (that.optionalEntity != null) {
							optionalJson = JSON.stringify(that.optionalEntity)
						}

						var individuationJson = null
						if (that.individuationEntity != null) {
							individuationJson = JSON.stringify(that.individuationEntity)
						}
						if (this.wishId == '') {
							uni.navigateTo({
								url: '/module_car/pages/orderConfirm/orderConfirm?carSeriesJson=' + JSON
									.stringify(
										that
										.carSeriesEntity) +
									"&carTypeJson=" + JSON.stringify(that.carTypeEntity) +
									"&configureJson=" + JSON.stringify(that.configureEntity) +
									"&colorJson=" + JSON.stringify(that.colorEntity) +
									"&optionalJson=" + optionalJson +
									"&individuationJson=" + individuationJson +
									"&totlePrice=" + that.totlePrice + "&from=" + that.from
							})
						} else {
							uni.navigateTo({
								url: '/module_car/pages/orderConfirm/orderConfirm?carSeriesJson=' + JSON
									.stringify(
										that
										.carSeriesEntity) +
									"&carTypeJson=" + JSON.stringify(that.carTypeEntity) +
									"&configureJson=" + JSON.stringify(that.configureEntity) +
									"&colorJson=" + JSON.stringify(that.colorEntity) +
									"&optionalJson=" + optionalJson +
									"&individuationJson=" + individuationJson +
									"&totlePrice=" + that.totlePrice + "&from=" + that.from + "&wishId=" + that
									.wishId + "&isWishEdit=" + that.tebsItemClicked
							})
						}

					} else {
						util.jumpLogin(this.from)
					}
				}

			},
			changeTab(val) {
				this.tabIndex = val
			},

			//获取车系列表
			getLevcCarSeriesList: function() {

				var that = this;
				var uri = app.globalData.config.interfaces.URL_CAR_SERIES_LIST;


				var params = {
					"loginId": app.getUserId(),
					"statusFlag": 0
				};
				console.log(params, 'params')
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						var _list = res.data;
						for (var i = 0; i < _list.length; i++) {
							if (that.choice_seriesId == _list[i].uuid) {
								_list[i].clicked = 1
								if (that.isFirstEnter == true && that.from == "车辆配置") {
									that.getCarSeries(_list[i])
									that.isFirstEnter = false
									that.carSeriesEntity = _list[i]
								}
								if (that.from == "心愿单编辑") {
									that.carSeriesEntity = _list[i]
								}

							} else {
								_list[i].clicked = 0
							}


						}
						that.carSeriesList = _list ? _list : []
					} else {
						setTimeout(() => {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}, 500)
					}
				}).catch(res => {


				});
			},
			//获取车型列表
			getLevcCarModelList: function(seriesId) {
				var that = this;
				var uri = app.globalData.config.interfaces.URL_CAR_MODEL_LIST;
				var params = {
					"loginId": app.getUserId(),
					"seriesId": seriesId,
					"statusFlag": 0
				};
				console.log(params, 'params')
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						var _list = res.data;
						for (var i = 0; i < _list.length; i++) {
							if (that.choice_modelId == _list[i].uuid) {
								_list[i].clicked = 1
								if (that.from == "心愿单编辑") {
									that.carTypeEntity = _list[i]
								}
							} else {
								_list[i].clicked = 0
							}
						}
						that.carTypeList = _list ? _list : []
					} else {
						setTimeout(() => {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}, 500)
					}
				}).catch(res => {


				});
			},
			//获取配置列表
			getLevcConfigList: function(carModelId) {
				var that = this;
				var uri = app.globalData.config.interfaces.URL_CAR_CONFIG_LIST;
				var params = {
					"carModelId": carModelId,
					"statusFlag": 0
				};
				console.log(params, 'params')
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						var _list = res.data;
						for (var i = 0; i < _list.length; i++) {
							if (that.choice_configId == _list[i].id) {
								_list[i].clicked = 1
								if (that.from == "心愿单编辑") {

									that.configureEntity = _list[i]
									that.configurePrice = that.configureEntity.carConfigMoney

									that.getTotlePrice()
									// that.getCarConfigureInfos(that.choice_configId)

								}
							} else {
								_list[i].clicked = 0
							}
						}
						that.configureList = _list ? _list : []
					} else {
						setTimeout(() => {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}, 500)
					}
				}).catch(res => {

				});
			},

			//获取其他信息列表：颜色、选装包、个性化
			getCarConfigureInfos: function(configId) {
				var that = this;
				var uri = app.globalData.config.interfaces.URL_CAR_OTHER_INFO_LIST;
				var params = {
					"id": configId,
					"statusFlag": 0
				};
				console.log(params, 'params')
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						//颜色列表
						var _colorList = res.data.colorList;
						for (var i = 0; i < _colorList.length; i++) {
							if (that.choice_colorId == _colorList[i].id) {
								_colorList[i].clicked = 1

								if (that.from == "心愿单编辑") {
									that.colorEntity = _colorList[i]
									// that.colorPrice = that.colorEntity.colorPrice
									that.getTotlePrice()
								}
							} else {
								_colorList[i].clicked = 0
							}
						}
						that.colorList = _colorList ? _colorList : []
						//选装包列表
						var _serverPkgList = res.data.serverPkgList;
						for (var i = 0; i < _serverPkgList.length; i++) {
							_serverPkgList[i].packageDescribeList = _serverPkgList[i].packageDescribe.split(
								";")
							if (that.choice_optionaId == _serverPkgList[i].id) {
								_serverPkgList[i].clicked = true
								if (that.from == "心愿单编辑") {
									that.optionalEntity = _serverPkgList[i]
									// that.optionalPrice = that.optionalEntity.packagePrice
								}
							} else {
								_serverPkgList[i].clicked = false
							}
						}
						that.optionalList = _serverPkgList ? _serverPkgList : []
						//个性化列表
						var _uniqueserverList = res.data.uniqueserverList;
						for (var i = 0; i < _uniqueserverList.length; i++) {
							_uniqueserverList[i].uniqueContent = ''
							_uniqueserverList[i].editshow = true
							if (that.choice_individuationId == _uniqueserverList[i].id) {
								_uniqueserverList[i].clicked = true
								if (that.from == "心愿单编辑") {
									_uniqueserverList[i].uniqueContent = that.choice_individuationText
									that.individuationEntity = _serverPkgList[i]
									// that.individuationPrice = that.individuationEntity.serverPrice
								}
							} else {
								_uniqueserverList[i].clicked = false
							}


						}
						that.individuationList = _uniqueserverList ? _uniqueserverList : []




					} else {
						setTimeout(() => {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}, 500)
					}
				}).catch(res => {

				});




			},




			//车系车型配置最低价
			getMinMoneyByCarConfigure: function(type) {

				var that = this;
				var uri = app.globalData.config.interfaces.URL_CAR_MIN_MONEY;
				var params = {}
				if (type == "车系") {
					params = {
						"seriesId": that.choice_seriesId,
						"modelId": ""
					}
				} else {
					params = {
						"seriesId": that.choice_seriesId,
						"modelId": that.choice_modelId,
					}
				}

				console.log(params, 'params')
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						that.totlePrice = res.data
					} else {
						setTimeout(() => {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}, 500)
					}
				}).catch(res => {

				});

			},



		}
	}
</script>

<style>
	@import "./carReservation.css";
</style>
